{% extends "mainapp/base.html" %}

{% load static %}
{% load bootstrap %}

{% block title %} 产品和型号管理 {% endblock %}


{% block content %}

    <div class="row">
        <div class="col-7"><h4 class="text-left">产品批次关系数据</h4></div>
        <div class="col-5 text-right">
            <h5><a href="/mainapp/create_product_lot_rel/">添加新数据</a>
                |<a href="{% url 'product_lot_rel_upload_excel' %}">批量导入</a>
                |<a href="{% url 'process_config' %}" target="_blank">API接口</a>
            </h5></div>
    </div>
    <div class="container mt-5">
        <table class="table">
            <thead>
            <tr>
                <th scope="col">序号</th>
                <th scope="col">ID</th>
                <th scope="col">Product Type</th>
                <th scope="col">Lot Number</th>
                <th scope="col">操作</th>
            </tr>
            </thead>
            <tbody>
            {% for product in products %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ product.id }}</td>
                    <td>{{ product.ProductType }}</td>
                    <td>{{ product.LotNumber }}</td>
                    <td>
                        <form method="post" action="{% url 'delete_product_lot_rel' product.id %}"
                              style="display:inline;">
                            {% csrf_token %}
                            <button type="submit" class="btn btn-danger btn-sm">删除</button>
                        </form>
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="3">No products found.</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>

{% endblock %}